﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PhysicsEngine.Common;
using PhysicsEngine.Dynamics;

namespace PhysicsEngine.Collision.Shapes
{
  [ContractClass(typeof(IShapeContract))]
  public interface IShape
  {
    void Render();

    /// <summary>
    /// Computes the mass from the volume of the shape and a given density.
    /// </summary>
    /// <param name="density">The density of the material.</param>
    /// <returns>A MassData object with the correct mass information.</returns>
    MassData ComputeMass(float density);
  }

  [ContractClassFor(typeof(IShape))]
  public abstract class IShapeContract : IShape
  {
    public void Render() { }

    public MassData ComputeMass(float density)
    {
      Contract.Requires<ArgumentException>(density > 0);
      return default(MassData); // return dummy value
    }
  }
}
